#include<bits/stdc++.h>
#define R register int 
using namespace std;
const int N=100005;
struct abc{
	int sum,wei;
}a[N],b[N];
int n,m;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(R i=1; i<=n; ++i) scanf("%d",&a[i]),a[i].wei=i,a[i].sum++;
	while(n!=0){
		m=0;
		for(R i=1; i<=n; ++i){
			if(a[i].sum!=a[i-1].sum) printf("%d ",a[i].wei);
			else b[++m]=a[i];
		}
		printf("\n");
		for(R i=1; i<=m; ++i) a[i]=b[i],b[i];
		n=m;
	}
	return 0;
}
